<template>
	<view class="column-css">
		<!-- <uni-steps
			style="padding-top: 40rpx;"
			activeColor="#2979FF"
			:options="[{ title: '录入个人信息' }, { title: '录入车辆信息' }, { title: '录入收款信息' }]"
			:active="0"
		></uni-steps> -->
		<view class="column-css view-cente">
			<view class="row-css view-cente-cle">
				<view class="view-cente-cle-text">所属承运商</view>
				<view style="position: relative;flex: 1;margin-top: -3rpx;z-index: 999;">
					<view v-if="disableEtpName">
						{{driverreg.etpName}}
					</view>
					<input v-if="!disableEtpName" v-model="driverreg.etpName" @input="search" placeholder="请输入承运企业全称" />
					<view class="ul">
						<view class="li" v-for="(item, index) in list" :key="index" @click="select(item)">{{ item.etpName }}</view>
					</view>
				</view>
				<image v-if="!disableEtpName" style="width: 38rpx;height: 33rpx;margin-left: 10rpx;" mode="aspectFit" @click="oncard" src="../../static/icon_scan.png"></image>
			</view>
		</view>
		<view class="row-css view-cente view-cente-cle" style="justify-content: space-between;align-items: center;margin: 0 30rpx;">
			<view class="row-css">
				<view class="view-cente-cle-text">当前手机号</view>
				<view>{{ userInfo.mobile }}</view>
			</view>
			<!-- <view v-if="isupdata == false" style="color: #4CD964;" @click="updatipone()">修改手机</view> -->
		</view>
		<view v-if="isupdata" class="row-css view-cente view-cente-cle" style="margin: 0 30rpx;">
			<view class="view-cente-cle-text">新手机号</view>
			<view class="row-css">
				<form><input v-model="newphone" type="phone" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="请输入新手机号" /></form>
			</view>
		</view>
		<view v-if="isupdata" class="row-css view-cent view-cente-cle" style="margin: 0 30rpx;border-bottom: 0rpx;">
			<view class="view-cente-cle-text" style="border-bottom: 1rpx solid #F1F1F1;display: flex; align-items: center;">短信验证码</view>
			<view style="border-bottom: 1rpx solid #F1F1F1;padding: 20rpx 0; margin-right: 20rpx; flex:1;">
				<form><input v-model="code" type="phone" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" placeholder="请输入短信验证码" /></form>
			</view>
			<view class="code-view" @click="sendcode()">{{ codeText }}</view>
		</view>
		<view style="width: 100%; height: 20rpx;background: #F1F1F1;margin: 20rpx 0pt;"></view>
		<view class="row-css" style="padding-left: 20rpx;">
			<view class="column-css" style="width: 8rpx;background: #2979ff;margin: 5rpx 10rpx;"></view>
			<view style="font-weight: bold;">请上传本人有效身份证 (必填)</view>
		</view>
		
		<view class="column-css" style="margin: 0 30rpx;color: #5f6579">
			<!-- <view>上传身份证与驾驶证</view> -->
			<view class="row-css" style="font-size: 24rpx;color: #333333;">
				<view class="column-css" style="padding-top: 25rpx;text-align: center;">
					<image
						style="width: 340rpx;height: 230rpx;"
						mode="aspectFit"
						id="idcard1"
						:src="driverreg.idcard1 == '' ? modeimage01 : driverreg.idcard1"
						@tap="chooseImage(1)"
					></image>
					<view style="padding-top: 15rpx;">身份证人像面</view>
				</view>
				<view class="column-css" style="padding-top: 25rpx;text-align: center;margin-left:20rpx;">
					<image
						style="width: 340rpx;height: 230rpx;"
						mode="aspectFit"
						id="idcard2"
						:src="driverreg.idcard2 == '' ? modeimage02 : driverreg.idcard2"
						@tap="chooseImage(2)"
					></image>
					<view style="padding-top: 15rpx;">身份证国徽面</view>
				</view>
			</view>
		</view>
		<view style="width: 100%; height: 20rpx;background: #F1F1F1;margin: 20rpx 0pt;"></view>
		<view style="font-weight: bold;padding-left: 30rpx;">请确定委托收款人信息</view>
		<view class="column-css view-cente">
			<view class="row-css view-cente-cle">
				<view class="view-cente-cle-text">姓名</view>
				<input style="z-index: 1;flex: 1;" 
				v-model="driverreg.driverName" 
				:disabled="driverreg.idcard1 ? false : true"
				:placeholder="driverreg.idcard1 ? '证件识别错误，请手动填写' : '请上传身份证,系统自动识别'"
				value="" />
			</view>
		</view>
		<view class="column-css view-cente">
			<view class="row-css view-cente-cle">
				<view class="view-cente-cle-text">身份证号</view>
				<input
					style="z-index: 1;flex: 1;"
					v-model="driverreg.idcard"
					:disabled="driverreg.idcard1 ? false : true"
					:placeholder="driverreg.idcard1 ? '证件识别错误，请手动填写' : '请上传身份证,系统自动识别'"
					value=""
				/>
			</view>
		</view>
		<view class="view-button" @click="shake()">去认证</view>
		
		
		
		<uni-popup ref="popup" type="bottom" mask-background-color="rgba(0,0,0,0.8)">
			<view class="popup-wrap">
				<view class="popup-describe">
					<image v-if="index == 1" src="../../static/icon_example_idcard01.png" mode="aspectFit"></image>
					<image v-if="index == 2" src="../../static/icon_example_idcard02.png" mode="aspectFit"></image>
					<view>
						<view class="title">{{title}}</view>
						<view class="desc">
							<view>保证证件四角可见，无遮挡，无反光；</view>
							<view>{{desc}}</view>
						</view>
					</view>
				</view>
				<view class="popup-box">
					<view @click="onCamera(0)">拍照</view>
					<view @click="onCamera(1)">从相册选择</view>
				</view>
				<view class="popup-cancel" @click="onCancel">取消</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			modeimage01: '../../static/icon_carmer01.png',
			modeimage02: '../../static/icon_carmer02.png',
			userInfo: {},
			isdriverId: false,
			newphone: '',
			code: '',
			time: 60,
			isupdata: false,
			codeText: '获取验证码',
			driverreg: {
				etpName: '',
				idcard1: '',
				idcard2: '',
				tqc: '',
				drivingLicenseDeputy: '',
				tqcDeputy: '',
				driverLicense: '',
				ipAddress: '',
				macAddress: ''
			},
			ipAddress: '',
			macAddress: '',
			idPhotoUp: '',
			idPhotoDown: '',
			carrieritems: [],
			list: [],
			platformCoNo: uni.getStorageSync(this.DATA_KEY.platformCoNo),
			
			timer: null,
			index: null,
			title: '',
			desc: '',
			disableEtpName: '',
			islivingcertifi:'',//认证状态
			isOnelive: '', //是否首次进入页面
		};
	},
	methods: {
		isLive(){
			let that = this
			this.wxRequest({
				url: `${this.API}/driverService/getDriverInfoByDriverID?driver_id=` + uni.getStorageSync(this.DATA_KEY.userInfo).driverId + '&etp_id=' + uni.getStorageSync(this.DATA_KEY.etpId),
				method: 'POST',
				title: '加载中...',
				success: res => {
					// console.log(res.data.data.userModel.livingBodyState,'是否活体')
					// console.log('返回数据', JSON.stringify(res.data.data));
					this.islivingcertifi = res.data.data.userModel.livingBodyState == 0 ? '未认证' : '已认证';
					if(res.data.data.userModel.livingBodyState == 1){
						that.pavee()
						uni.redirectTo({
							url: '/pages/personal/review?isw=' + 1
						});
					}else{
						this.wxRequest({
							url: `${this.API}/driverService/delegatedPayeeLive`,
							method: 'POST',
							data:{driverId: uni.getStorageSync(this.DATA_KEY.userInfo).driverId},
							title: '加载中...',
							success: res => {
								console.log(res.data.data)
								//1未认证 0已认证
								// res.data.data == 1
								if(res.data.data == 1) {
									console.log(uni.getStorageSync('isOnelive'))
									if(uni.getStorageSync('isOnelive') == 0){
										console.log('首次进入不进行判断')
										return false
									}
									//税局是否活体接口
									that.wxRequest({
										url: `${that.API}/driverService/getDriverIdCardInfo`,
										method: 'POST',
										title: '加载中...',
										data: {
											driverId: that.userInfo.driverId,
											platformCoNo: that.platformCoNo
										},
										success: res => {
											let accessToken = res.data.data.accessToken; //认证令牌
											uni.setStorageSync(this.DATA_KEY.accessToken, accessToken);
											let taxNumber = res.data.data.taxNumber; //平台税号
											if(that.idPhotoUp == '' || that.idPhotoDown == ''){
												that.idPhotoUp = res.data.data.idcard1Base64;
												that.idPhotoDown = res.data.data.idcard2Base64;
											}
											that.wxRequestData({
												url: `${that.API2}/api/face/getFaceQRCode?access_token=` + accessToken,
												method: 'POST',
												data: {
													companyTaxNumber: taxNumber,
													realName: that.driverreg.driverName,
													idCard: that.driverreg.idcard,
													idPhotoUp: that.idPhotoUp,
													idPhotoDown: that.idPhotoDown,
													callbackUrl: `${that.API}/driverService/isLivingBodyState`
												},
												success: res => {
													if (res.data.code == 0) {
														let orderNumber = res.data.data.orderNumber;
														uni.setStorageSync(this.DATA_KEY.orderNumber, orderNumber);
														that.wxRequest({
															url: `${that.API}/driverService/saveFaceVerifyState`,
															method: 'POST',
															data: {
																driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
																orderNumber: orderNumber,
																platformCoId: uni.getStorageSync(that.DATA_KEY.platformCoNo) == '0001' ? '100001' : '100002',
																accessToken: accessToken
															},
															success: res => {
																console.log(res.data,'9999999999')
															}
														})	
													}
												}
											})
										}
									})
								}else{
									that.pavee()
									uni.redirectTo({
										url: '/pages/personal/review?isw=' + 1
									});
								}
							}
						})		
					}
				}
			})
		},
		updatipone() {
			this.isupdata = true;
		},
		livingcertification() {
			let that = this;
			that.wxRequest({
				url: `${that.API}/driverService/getDriverIdCardInfo`,
				method: 'POST',
				title: '加载中...',
				data: {
					driverId: that.userInfo.driverId,
					platformCoNo: that.platformCoNo
				},
				success: res => {
					let accessToken = res.data.data.accessToken; //认证令牌
					uni.setStorageSync(this.DATA_KEY.accessToken, accessToken);
					let taxNumber = res.data.data.taxNumber; //平台税号
					if(that.idPhotoUp == '' || that.idPhotoDown == ''){
						that.idPhotoUp = res.data.data.idcard1Base64;
						that.idPhotoDown = res.data.data.idcard2Base64;
					}
					console.log('==活体认证回调地址==========>', `${that.API}/driverService/isLivingBodyState`);
					that.wxRequestData({
						url: `${that.API2}/api/face/getFaceQRCode?access_token=` + accessToken,
						method: 'POST',
						data: {
							companyTaxNumber: taxNumber,
							realName: that.driverreg.driverName,
							idCard: that.driverreg.idcard,
							idPhotoUp: that.idPhotoUp,
							idPhotoDown: that.idPhotoDown,
							callbackUrl: `${that.API}/driverService/isLivingBodyState`
						},
						success: res => {
							if (res.data.code == 0) {
								let orderNumber = res.data.data.orderNumber;
								uni.setStorageSync(this.DATA_KEY.orderNumber, orderNumber);
								console.log('==活体认证订单号==========>', res.data.data.orderNumber);
								that.wxRequest({
									// url: `${that.API}/driverService/saveFaceVerifyOrderNo`,
									url: `${that.API}/driverService/saveFaceVerifyOrderNumber`,
									method: 'POST',
									data: {
										driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
										orderNumber: orderNumber,
										// platformCoNo: that.platformCoNo
										platformCoId: uni.getStorageSync(this.DATA_KEY.platformCoNo) == '0001' ? '100001' : '100002'
									},
									success: res => {
										// #ifdef APP-PLUS
										uni.showModal({
											title: '提示',
											content: '是否去进行实名认证?跳转进行实名认证后需要重新打开当前APP!',
											success: function(res) {
												if (res.confirm) {
													console.log('用户点击确定');
													uni.setStorageSync('isOnelive',1);
													// uni.setStorageSync(that.DATA_KEY.liveFlag, true);
													plus.share.getServices(
														function(res) {
															uni.setStorageSync(that.DATA_KEY.liveFlag, true);
															var sweixin = null;
															console.log(res);
															for (var i = 0; i < res.length; i++) {
																var t = res[i];
																console.log(t);
																if (t.id == 'weixin') {
																	sweixin = t;
																}
															}
															if (sweixin) {
																console.log('dddd=', 'a=' + sweixin + '=b');
																sweixin.launchMiniProgram({
																	// id: 'gh_cec8224b00da',
																	id: 'gh_45eec401ff1c',
																	type: 0, //0-正式版 1.测试版，2，体验版
																	path: 'pages/verify/info/index?id=' + orderNumber
																});
															}
														},
														function(res) {
															console.log(JSON.stringify(res));
														}
													);
												} else if (res.cancel) {
													console.log('用户点击取消');
												}
											}
										});
										// #endif
										
										// #ifdef MP-WEIXIN
										uni.showModal({
											title: '提示',
											content: '是否去进行实名认证?',
											success: function(res) {
												if (res.confirm) {
													console.log('用户点击确定');
													//uni.navigateToMiniProgram  打开另一个小程序
													uni.setStorageSync('isOnelive',1);
													uni.navigateToMiniProgram({
														// appId: 'wxfd2861dc1c86b3a0',
														appId: 'wxfc1e27e05fdd062b',
														path: 'pages/verify/info/index?id=' + orderNumber,
														envVersion: 'release',
														success(res) {
															uni.setStorageSync(that.DATA_KEY.liveFlag, true);
															console.log('跳转成功');
														},
														fail(res) {
															console.log('跳转失败' + JSON.stringify(res));
														}
													});
												} else if (res.cancel) {
													console.log('用户点击取消');
												}
											}
										});
										// #endif
									}
								});
								
							}
						}
					});
				}
			});
		},
		chooseImage: async function(index) {
			this.index = index
			this.$refs.popup.open()
			if(this.index == 1) {
				this.title = '请上传身份证人像面照片'
				this.desc = '姓名、身份证号码等信息清晰，无涂改'
			} else if(this.index == 2) {
				this.title = '请上传身份证国徽面照片'
				this.desc = '签发机关、有效期等信息清晰，无涂改'
			} else if(this.index == 3) {
				this.title = '请上传本人驾驶证正页照片'
				this.desc = '同时支持电子驾驶证正页照片，文字清晰可辩'
			} else if(this.index == 4) {
				this.title = '请上传本人驾驶证副页照片'
				this.desc = '同时支持电子驾驶证副页照片，文字清晰可辩'
			} else if(this.index == 5) {
				this.title = '请上传本人从业资格证照片'
				this.desc = '姓名、证件号码、有效期等信息清晰，无涂改'
			}
			return
			// TODO 选择相机或相册时 需要弹出actionsheet，目前无法获得是相机还是相册，在失败回调中处理
			uni.chooseImage({
				count: 1,
				sizeType: 'compressed',
				success: res => {
					console.log('ddd======1------------>', res.tempFiles);
					console.log('ddd======2------------>', res.tempFiles[0]);
					console.log('ddd======3------------>', res.tempFiles[0].size);
					let resSize = res.tempFiles[0].size;
					if (resSize > 10485760) {
						uni.showToast({
							title: '上传的图片大小不超过10M,请重新上传！',
							icon: 'none',
							duration: 2000,
							mask: true
						});
						return;
					}
					uni.showLoading({
						title: '上传中'
					});
					if (index == 1) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadIdcard`,
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '2',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('身份证正面: ', JSON.parse(res.data));
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.idcard1 = JSON.parse(res.data).data.imgurl;
									this.idPhotoUp = JSON.parse(res.data).data.idCardBase64;
									// this.driverreg._driverName = JSON.parse(res.data).data.name;
									this.driverreg.driverName = JSON.parse(res.data).data.name;
									// this.driverreg._idcard = JSON.parse(res.data).data.id;
									this.driverreg.idcard = JSON.parse(res.data).data.id;
									this.driverreg.driverNameOcrIdcard = JSON.parse(res.data).data.name;
									this.driverreg.idOcrIdcard = JSON.parse(res.data).data.id;
									this.driverreg.uploadIdCardFlag = JSON.parse(res.data).data.uploadIdCardFlag;
									this.driverreg.uploadIdCardMsg = JSON.parse(res.data).data.uploadIdCardMsg;
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 2) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadIdcardBack`, //仅为示例，非真实的接口地址
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '3',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('身份证国徽面: ', JSON.parse(res.data));
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.idcard2 = JSON.parse(res.data).data.imgurl;
									this.idPhotoDown = JSON.parse(res.data).data.idCardBackBase64;
									// if (JSON.parse(res.data).data.start_date != '' && JSON.parse(res.data).data.valid_date != '') {
										console.log(this.fordata(JSON.parse(res.data).data.start_date))
										this.driverreg.idcardValidDate = this.fordata(JSON.parse(res.data).data.start_date)+ '-' + this.fordata(JSON.parse(res.data).data.valid_date);
										this.driverreg.idcardStartDate = this.fordata(JSON.parse(res.data).data.start_date);
										this.driverreg.idcardEndDate = this.fordata(JSON.parse(res.data).data.valid_date);
										this.driverreg.manualIdcardStartTime = this.fordata(JSON.parse(res.data).data.start_date);
										this.driverreg.manualIdcardEndTime = this.fordata(JSON.parse(res.data).data.valid_date);
									// }
									this.driverreg.uploadIdCardBackFlag = JSON.parse(res.data).data.uploadIdCardBackFlag;
									this.driverreg.uploadIdCardBackMsg = JSON.parse(res.data).data.uploadIdCardBackMsg;
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 3) {
						uni.uploadFile({
							// url: `${this.API}/driverService/upload_driving`, //仅为示例，非真实的接口地址
							url: `${this.API}/driverService/newUploadDriving`, //仅为示例，非真实的接口地址
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '4',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('驾驶证正面: ', JSON.parse(res.data));
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.driverLicense = JSON.parse(res.data).data.imgurl;
									// if (JSON.parse(res.data).data.start_date != '' && JSON.parse(res.data).data.date != '') {
										this.driverreg.driverStartDate = this.fordata(JSON.parse(res.data).data.driverStartDate);
										this.driverreg.driverEndDate = this.fordata(JSON.parse(res.data).data.driverEndDate);
										this.driverreg.driverNameOcrDriverLicense = JSON.parse(res.data).data.driverNameOcrDriverLicense;
										this.driverreg.driverLcsValidDate = this.fordata(JSON.parse(res.data).data.driverStartDate) + '-' + this.fordata(JSON.parse(res.data).data.driverEndDate);
										this.driverreg.idOcrDriverLicense = JSON.parse(res.data).data.idOcrDriverLicense;
										this.driverreg.driverModel = JSON.parse(res.data).data.driverModel;
										if(JSON.parse(res.data).data.issuingOrganizations){
											this.driverreg.issuingOrganizations = JSON.parse(res.data).data.issuingOrganizations;
										}
										this.driverreg.manualDriveStartTime = this.fordata(JSON.parse(res.data).data.driverStartDate);
										this.driverreg.manualDriveEndTime = this.fordata(JSON.parse(res.data).data.driverEndDate);
									// }
									this.driverreg.uploadDrivingFlag = JSON.parse(res.data).data.uploadDrivingFlag;
									this.driverreg.uploadDrivingMsg = JSON.parse(res.data).data.uploadDrivingMsg;
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 4) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadDrivingBack`,
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								// 'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '2',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('驾驶证副页: ', JSON.parse(res.data));
								let data = JSON.parse(res.data)
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.drivingLicenseDeputy = JSON.parse(res.data).data.imgUrl;
									// console.log(this.driverreg.issuingOrganizations)
									if(!this.driverreg.issuingOrganizations) {
										this.driverreg.issuingOrganizations = JSON.parse(res.data).data.issuingOrganizations;
										console.log(this.driverreg.issuingOrganizations)
									}
									this.$forceUpdate();
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 5) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadTqc`,
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								// 'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '2',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								uni.hideLoading();

								if (JSON.parse(res.data).code == 0) {
									this.driverreg.tqc = JSON.parse(res.data).data.imgurl;
									this.driverreg.tqcNo = JSON.parse(res.data).data.tqcNo;
									this.$forceUpdate();
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 6) {
						uni.uploadFile({
							url: `${this.API}/driverService/upload`,
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								// 'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '2',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('从业资格证反面: ', JSON.parse(res.data));
								uni.hideLoading();

								if (JSON.parse(res.data).code == 0) {
									this.driverreg.tqcDeputy = JSON.parse(res.data).data;
									this.$forceUpdate();
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					}
				}
			});
		},
		onCancel(){
			this.$refs.popup.close()
		},
		onCamera(num) {
			let sourceType
			num === 0 ? sourceType = ['camera'] : sourceType = ['album'] 
			let index = this.index
			this.$refs.popup.close()
			uni.chooseImage({
				count: 1,
				sourceType: sourceType,
				sizeType: 'compressed',
				success: res => {
					console.log('ddd======1------------>', res.tempFiles);
					console.log('ddd======2------------>', res.tempFiles[0]);
					console.log('ddd======3------------>', res.tempFiles[0].size);
					let resSize = res.tempFiles[0].size;
					if (resSize > 10485760) {
						uni.showToast({
							title: '上传的图片大小不超过10M,请重新上传！',
							icon: 'none',
							duration: 2000,
							mask: true
						});
						return;
					}
					uni.showLoading({
						title: '上传中'
					});
					if (index == 1) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadIdcard`,
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '2',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('身份证正面: ', JSON.parse(res.data));
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.idcard1 = JSON.parse(res.data).data.imgurl;
									this.idPhotoUp = JSON.parse(res.data).data.idCardBase64;
									// this.driverreg._driverName = JSON.parse(res.data).data.name;
									this.driverreg.driverName = JSON.parse(res.data).data.name;
									// this.driverreg._idcard = JSON.parse(res.data).data.id;
									this.driverreg.idcard = JSON.parse(res.data).data.id;
									this.driverreg.driverNameOcrIdcard = JSON.parse(res.data).data.name;
									this.driverreg.idOcrIdcard = JSON.parse(res.data).data.id;
									this.driverreg.uploadIdCardFlag = JSON.parse(res.data).data.uploadIdCardFlag;
									this.driverreg.uploadIdCardMsg = JSON.parse(res.data).data.uploadIdCardMsg;
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} else if (index == 2) {
						uni.uploadFile({
							url: `${this.API}/driverService/uploadIdcardBack`, //仅为示例，非真实的接口地址
							fileType: 'image',
							name: 'file',
							filePath: res.tempFilePaths[0],
							file: res.tempFiles,
							header: {
								'Content-Type': 'multipart/form-data;boundary=ebf9f03029db4c2799ae16b5428b06bds',
								Authorization: uni.getStorageSync(this.DATA_KEY.token)
							},
							formData: {
								fileType: '3',
								mobile: this.userInfo.mobile,
								fileId: Math.floor(Math.random() * 1259),
								ocrOrNot: '1',
								orderId: ''
							},
							success: res => {
								console.log('身份证国徽面: ', JSON.parse(res.data));
								uni.hideLoading();
								if (JSON.parse(res.data).code == 0) {
									this.driverreg.idcard2 = JSON.parse(res.data).data.imgurl;
									this.idPhotoDown = JSON.parse(res.data).data.idCardBackBase64;
									// if (JSON.parse(res.data).data.start_date != '' && JSON.parse(res.data).data.valid_date != '') {
										console.log(this.fordata(JSON.parse(res.data).data.start_date))
										this.driverreg.idcardValidDate = this.fordata(JSON.parse(res.data).data.start_date)+ '-' + this.fordata(JSON.parse(res.data).data.valid_date);
										this.driverreg.idcardStartDate = this.fordata(JSON.parse(res.data).data.start_date);
										this.driverreg.idcardEndDate = this.fordata(JSON.parse(res.data).data.valid_date);
										this.driverreg.manualIdcardStartTime = this.fordata(JSON.parse(res.data).data.start_date);
										this.driverreg.manualIdcardEndTime = this.fordata(JSON.parse(res.data).data.valid_date);
									// }
									this.driverreg.uploadIdCardBackFlag = JSON.parse(res.data).data.uploadIdCardBackFlag;
									this.driverreg.uploadIdCardBackMsg = JSON.parse(res.data).data.uploadIdCardBackMsg;
								} else {
									uni.showToast({
										title: JSON.parse(res.data).msg,
										icon: 'none'
									});
								}
							},
							fail: error => {
								uni.showToast({
									title: '文件上传失败',
									icon: 'none'
								});
							}
						});
					} 
				},
				fail: (err) => {
					console.log(err)
				}
			})
		},
		search(e) {
			let val = e.detail.value;
			console.log('ddddddddddd 是否包含', val);
			// if (val.length > 2) {
			let { carrieritems } = this;
			let arr = [];
			for (let i = 0; i < carrieritems.length; i++) {
				if (carrieritems[i].etpName.indexOf(val) !== -1) {
					arr.push(carrieritems[i]);
				}
			}
			if (!val) {
				this.list = [];
			} else {
				this.list = arr;
				let obj = this.list.filter((item) => {
					return val === item.etpName
				})
				if(obj.length){
					console.log(11111)
					this.select(obj[0])
					// this.driverreg.etpId = obj[0].etpId;
					// this.driverreg.etpName = obj[0].etpName;
				}
			}
		},
		select(item) {
			this.driverreg.etpId = item.etpId;
			this.driverreg.etpName = item.etpName;
			this.list = [];
		},
		sendcode() {
			var reg = 11 && /^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/;
			if (this.newphone == '' && this.newphone != null) {
				uni.showToast({
					title: '请输入手机号码',
					icon: 'none'
				});
			} else if (!reg.test(this.newphone)) {
				uni.showToast({
					title: '手机格式不正确',
					icon: 'none'
				});
			} else {
				if (this.time == 60) {
					this.timer = setInterval(() => {
						this.codeText = `${this.time}s后获取验证码`;
						this.time--;
						if (this.time < 0) {
							this.time = 60;
							this.codeText = '获取验证码';
							clearInterval(this.timer);
						}
					}, 1000);
					this.wxRequest({
						url: `${this.API}/miniApp/auth/sms-code?tel=` + this.newphone,
						method: 'POST',
						title: '验证码发送中...',
						success: res => {
							if (res.data.code == 200) {
								uni.showToast({
									title: '验证码已发送成功',
									icon: 'none'
								});
							}
						}
					});
				}
			}
		},
		onSubscribeMessage() {
			uni.getSetting({
				withSubscriptions: true,
				success(res) {
					if (res.subscriptionsSetting.mainSwitch == true) {
						console.log('1=2===========>', res);
						if (res.subscriptionsSetting.itemSettings != null) {
							//是否总是记住
							if (res.subscriptionsSetting.itemSettings['1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'] != 'accept') {
								//是否允许（否）
								uni.showModal({
									title: '司机小程序"需要您授权接收订阅通知！',
									// content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
									confirmText: '去设置',
									showCancel: false,
									success(res) {
										if (res.confirm) {
											uni.openSetting({
												success(res) {}
											});
										}
									}
								});
							}
						} else {
							uni.requestSubscribeMessage({
								tmplIds: ['1XVivLfWx3FXmj1GIuQP0dI31xOTQkGoTqUoB1XqcKY'],
								success(res) {
									console.log('1============>', res);
									// uni.setStorageSync(this.DATA_KEY.issubscription, idPhotoUp);
								}
							});
						}
					} else {
						uni.showModal({
							title: '"司机小程序"需要您授权接收订阅消息！',
							// content: '请点击设置->打开位置信息->使用小程序期间和离开小程序后',
							confirmText: '去设置',
							showCancel: false,
							success(res) {
								if (res.confirm) {
									uni.openSetting({
										success(res) {}
									});
								}
							}
						});
					}
				}
			});
		},
		
		shake() {
		    if (this.timer) {
		        clearTimeout(this.timer)
		    }
		    this.timer = setTimeout(() => {
				console.log(888888)
		        this.onnext()
		    }, 1000)
		},
		// 认证
		pavee(){
			let driverId = uni.getStorageSync(this.DATA_KEY.userInfo).driverId;
			let that = this
			that.wxRequest({
				url: `${that.API}/mini/jzb/applyToPayUser`,
				method: 'POST',
				data: {
					etpId: this.driverreg.etpId
				},
				title: '申请中...',
				success: res => {
					// uni.navigateTo({
					// 	url: `/pages/personal/delegatedPavee`
					// });
				}
			});
		},
		onnext() {
			// this.driverreg.driverNameOcrIdcard = this.driverreg.driverName;
			// this.driverreg.idOcrIdcard = this.driverreg.idcard;
			this.driverreg.ipAddress = this.ipAddress;
			this.driverreg.macAddress = this.macAddress;
			if(!this.driverreg.ipAddress){
				this.wxRequest({
					// 获取ip
					url: `${this.API}/driverService/getIp`,
					success(res) {
						this.driverreg.ipAddress = res.data.data.ip
					}
				});
			}
			if (
				this.driverreg.driverName != '' &&
				this.driverreg.idcard1 != '' &&
				this.driverreg.idcard2 != '' 
				// && this.driverreg.driverLicense != '' &&
				// this.driverreg.drivingLicenseDeputy != ''
			) {
				// #ifdef MP-WEIXIN
				this.driverreg.signChannel = 4;
				// #endif
				// #ifdef APP-PLUS
				this.driverreg.signChannel = 1;
				// #endif

				this.driverreg.driverId = this.userInfo.driverId;
				// if (this.isupdata) {
				// 	this.wxRequest({
				// 		url: `${this.API}/driverService/updateDriverMobile?driver_id=` + this.userInfo.driverId + '&mobile=' + this.newphone + '&code=' + this.code,
				// 		method: 'POST',
				// 		success: res => {
				// 			this.driverreg.mobile = this.newphone;
				// 			if (this.isdriverId) {
				// 				this.wxRequest({
				// 					url: `${this.API}/driverService/driverSubmit`,
				// 					method: 'POST',
				// 					data: this.driverreg,
				// 					title: '提交中...',
				// 					success: res => {
				// 						uni.setStorageSync(this.DATA_KEY.etpId, this.driverreg.etpId);
				// 						uni.setStorageSync(this.DATA_KEY.etpName, this.driverreg.etpName);

				// 						// #ifdef MP-WEIXIN
				// 						this.onSubscribeMessage();
				// 						// #endif
				// 						uni.redirectTo({
				// 							url: '../personal/review?iscar=' + true
				// 						});
				// 					}
				// 				});
				// 			} else {
				// 				this.wxRequest({
				// 					url: `${this.API}/driverService/driverRegister`,
				// 					method: 'POST',
				// 					data: this.driverreg,
				// 					title: '提交中...',
				// 					success: res => {
				// 						uni.setStorageSync(this.DATA_KEY.etpId, this.driverreg.etpId);
				// 						uni.setStorageSync(this.DATA_KEY.etpName, this.driverreg.etpName);
				// 						// #ifdef MP-WEIXIN
				// 						this.onSubscribeMessage();
				// 						// #endif
				// 						uni.redirectTo({
				// 							url: '../personal/review?iscar=' + true
				// 						});
				// 					}
				// 				});
				// 			}
				// 		}
				// 	});
				// } else {
				this.driverreg.mobile = uni.getStorageSync(this.DATA_KEY.userInfo).mobile;
				// this.driverreg.mobileInCar = uni.getStorageSync(this.DATA_KEY.userInfo).mobile;
				let that = this;
				that.wxRequest({
					url: `${that.API}/driverService/checkIdCardUnique`,
					method: 'POST',
					title: '校验中...',
					data: {
						driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
						idcard: that.driverreg.idcard
					},
					success: res => {
						if (res.data.data.status != 0) {
							uni.showModal({
								title: '提示',
								content: res.data.data.message,
								showCancel:false,
								confirmText: '确认',
								success: function(res) {
									// if (res.confirm) {
									// 	// if (that.isdriverId) {
									// 	// 	that.wxRequest({
									// 	// 		url: `${that.API}/driverService/driverSubmit`,
									// 	// 		method: 'POST',
									// 	// 		data: that.driverreg,
									// 	// 		title: '提交中...',
									// 	// 		success: res => {
									// 	// 			uni.setStorageSync(that.DATA_KEY.etpId, that.driverreg.etpId);
									// 	// 			uni.setStorageSync(that.DATA_KEY.etpName, that.driverreg.etpName);
									// 	// 			// #ifdef MP-WEIXIN
									// 	// 			that.onSubscribeMessage();
									// 	// 			// #endif
									// 	// 			uni.redirectTo({
									// 	// 				url: '../personal/review?iscar=' + true
									// 	// 			});
									// 	// 		}
									// 	// 	});
									// 	// } else {
									// 	that.wxRequest({
									// 		url: `${that.API}/driverService/driverRegister`,
									// 		method: 'POST',
									// 		data: that.driverreg,
									// 		title: '提交中...',
									// 		success: res => {
									// 			uni.setStorageSync(that.DATA_KEY.etpId, that.driverreg.etpId);
									// 			uni.setStorageSync(that.DATA_KEY.etpName, that.driverreg.etpName);
									// 			that.livingcertification();
									// 			// #ifdef MP-WEIXIN
									// 			that.onSubscribeMessage();
									// 			// #endif
									// 			uni.redirectTo({
									// 				url: '../personal/review?iscar=' + true
									// 			});
									// 		}
									// 	});
									// 	// }
									// } else if (res.cancel) {
									// 	uni.setStorageSync(that.DATA_KEY.userInfo, '');
									// 	uni.setStorageSync(that.DATA_KEY.token, '');
									// 	uni.setStorageSync(that.DATA_KEY.etpId, '');
									// 	uni.setStorageSync(that.DATA_KEY.etpName, '');
									// 	uni.setStorageSync(that.DATA_KEY.oldTime, '');
									// 	uni.setStorageSync(that.DATA_KEY.loadingOrderId, '');
									// 	// #ifdef MP-WEIXIN
									// 	uni.redirectTo({
									// 		url: '../personal/quicklogin'
									// 	});
									// 	// #endif
									// 	// #ifdef APP-PLUS
									// 	uni.redirectTo({
									// 		url: '../personal/login'
									// 	});
									// 	// #endif
									// }
								}
							});
						} else {
							console.log(Date.parse(that.driverreg.idcardEndDate) < new Date().getTime())
							console.log(Date.parse(that.driverreg.driverEndDate) < new Date().getTime())
							// if(that.driverreg.driverName != that.driverreg.driverNameOcrIdcard){
							// 	this.driverreg.uploadIdCardFlag = 1;
							// 	this.driverreg.uploadIdCardMsg = '真实姓名和身份证证件不一致';
							// 	uni.showToast({
							// 		title: '您提交的真实姓名和身份证证件不一致，请重新修改后再提交',
							// 		icon: 'none'
							// 	});
							// 	// uni.showModal({
							// 	// 	content: '您提交的真实姓名和身份证证件不一致，请重新修改后再提交',
							// 	// 	cancelText: '去申诉',
							// 	// 	cancelColor: '#999999',
							// 	// 	success: function (res) {
							// 	// 		if (res.confirm) {
							// 	// 			return
							// 	// 		} else if (res.cancel) {
							// 	// 			that._submit(1)
							// 	// 		}
							// 	// 	}		
							// 	// })
							// }else if(that.driverreg.idcard != that.driverreg.idOcrIdcard){
							// 	this.driverreg.uploadIdCardFlag = 1;
							// 	this.driverreg.uploadIdCardMsg = '输入身份证号和身份证证件不一致';
							// 	uni.showToast({
							// 		title: '您提交的输入身份证号和身份证证件不一致，请重新修改后再提交',
							// 		icon: 'none'
							// 	});
							// 	// uni.showModal({
							// 	// 	content: '您提交的输入身份证号和身份证证件不一致，请重新修改后再提交',
							// 		// cancelText: '去申诉',
							// 		// cancelColor: '#999999',
							// 		// success: function (res) {
							// 		// 	if (res.confirm) {
							// 		// 		return
							// 		// 	} else if (res.cancel) {
							// 		// 		that._submit(1)
							// 		// 	}
							// 		// }		
							// 	// })
							// }else if(that.driverreg.uploadIdCardFlag == 1){
							// 	uni.showToast({
							// 		title: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		icon: 'none'
							// 	});
							// 	// uni.showModal({
							// 	// 	content: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		// cancelText: '去申诉',
							// 		// cancelColor: '#999999',
							// 		// success: function (res) {
							// 		// 	if (res.confirm) {
							// 		// 		return
							// 		// 	} else if (res.cancel) {
							// 		// 		that._submit(1)
							// 		// 	}
							// 		// }		
							// 	// })
							// }else if(that.driverreg.uploadIdCardBackFlag == 1){
							// 	uni.showToast({
							// 		title: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		icon: 'none'
							// 	});
							// 	// uni.showModal({
							// 	// 	content: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		// cancelText: '去申诉',
							// 		// cancelColor: '#999999',
							// 		// success: function (res) {
							// 		// 	if (res.confirm) {
							// 		// 		return
							// 		// 	} else if (res.cancel) {
							// 		// 		that._submit(1)
							// 		// 	}
							// 		// }		
							// 	// })
							// }else if(!that.driverreg.idcardValidDate){
							// 	this.driverreg.uploadIdCardFlag = 1;
							// 	this.driverreg.uploadIdCardMsg = '身份证疑似非有效证件';
							// 	uni.showToast({
							// 		title: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		icon: 'none'
							// 	});
							// 	// uni.showModal({
							// 	// 	content: '您提交的身份证疑似非有效证件，请重新修改后再提交',
							// 		// cancelText: '去申诉',
							// 		// cancelColor: '#999999',
							// 		// success: function (res) {
							// 		// 	if (res.confirm) {
							// 		// 		return
							// 		// 	} else if (res.cancel) {
							// 		// 		that._submit(1)
							// 		// 	}
							// 		// }		
							// 	// })
							// }else {
								that._submit(2)
							// }
						}
					}
				});
				// }
			} else {
				uni.showToast({
					title: '请完善信息！',
					icon: 'none'
				});
			}
		},
		fordata(validPeriod) {
			let reg = new RegExp("\\d{4}(-|/|.)\\d{2}(-|/|.)\\d{2}");
			let ret = reg.test(validPeriod);
			console.log(ret);
			if (!ret) {
				return "";
			} else {
				return validPeriod.match(reg)[0]
		  }
		},
		_submit(num) {
			let that = this
			that.driverreg.uploadDrivingFlag = that.driverreg.uploadDrivingFlag || 0
			that.driverreg.uploadIdCardBackFlag = that.driverreg.uploadIdCardBackFlag || 0
			that.driverreg.uploadIdCardFlag = that.driverreg.uploadIdCardFlag || 0
			// that.pavee()
			if(this.disableEtpName){
				uni.setStorageSync(that.DATA_KEY.etpId, that.driverreg.etpId);
				uni.setStorageSync(that.DATA_KEY.etpName, that.driverreg.etpName);
				
				// if(!that.driverreg.uploadDrivingFlag && !that.driverreg.uploadIdCardBackFlag && !that.driverreg.uploadIdCardFlag){
					that.livingcertification();			
				// }
				// #ifdef MP-WEIXIN
				that.onSubscribeMessage();
				// #endif
			}else{
				that.wxRequest({
					url: `${that.API}/driverService/driverRegister`,
					method: 'POST',
					data: {...that.driverreg, payeeType: '1'},
					title: '提交中...',
					success: res => {
						uni.setStorageSync(that.DATA_KEY.etpId, that.driverreg.etpId);
						uni.setStorageSync(that.DATA_KEY.etpName, that.driverreg.etpName);
						console.log(1111111111111111111111111,!that.driverreg.uploadDrivingFlag && !that.driverreg.uploadIdCardBackFlag && !that.driverreg.uploadIdCardFlag)
						// return false
						// if(!that.driverreg.uploadDrivingFlag && !that.driverreg.uploadIdCardBackFlag && !that.driverreg.uploadIdCardFlag){
							that.livingcertification();			
							
						// }
						// #ifdef MP-WEIXIN
						that.onSubscribeMessage();
						// #endif
					
						// uni.redirectTo({
						// 	// url: '../personal/review?iscar=' + true
						// 	url: '../personal/review?iscar=' + true + '&&num='+ num +'&&text=司机'
						// });
						
					}
				});
			}
			
		},
		oncard() {
			let that = this;
			uni.scanCode({
				scanType: ['qrCode'],
				success: function(res) {
					console.log('条码：' + JSON.stringify(res));
					that.driverreg.etpId = res.result.split('=')[2].split('&')[0];
					that.driverreg.etpName = res.result.split('=')[3].split('&')[0];
					if (res.result.split('=').length > 4) {
						that.driverreg.exemptCode = res.result.split('=')[4];
					}
					that.wxRequest({
						url: `${that.API}/driverService/checkInvitationCode`,
						method: 'POST',
						data: {
							driverId: uni.getStorageSync(that.DATA_KEY.userInfo).driverId,
							etpId: that.driverreg.etpId,
							exemptCode: that.driverreg.exemptCode
						},
						success: res => {}
					});
				}
			});
		}
	},
	onShow(){
		this.isLive()
	},
	onLoad: function(options) {
		this.userInfo = uni.getStorageSync(this.DATA_KEY.userInfo);
		// this.isdriverId = options.isdriverId;

		if (this.userInfo.etpId) {
			this.isdriverId = true;
		}
		
		// this.wxRequest({
		// 	url: `${this.API}/user/info/query`,
		// 	method: 'POST',
		// 	data: {
		// 		mobile: this.userInfo.mobile
		// 	},
		// 	title: '加载中...',
		// 	success: res => {
		// 		if (JSON.stringify(res.data.data) != '{}') {
		// 			this.driverreg = res.data.data;
		// 		}
		// 	}
		// });
		this.wxRequest({
			url: `${this.API}/driverService/getEtpList?is_enable=1`,
			method: 'POST',
			success: res => {
				this.carrieritems = res.data.data.list;
				console.log('=============>', this.carrieritems);
			}
		});
		if (this.isdriverId) {
			let driverId = this.userInfo.driverId;
			this.wxRequest({
				url: `${this.API}/driverService/getDriverInfoByDriverID?driver_id=` + driverId + '&etp_id=' + uni.getStorageSync(this.DATA_KEY.etpId),
				method: 'POST',
				title: '加载中...',
				success: res => {
					
					this.driverreg = res.data.data.userModel;
					this.driverreg.driverName = res.data.data.userModel.driverName || res.data.data.userModel.driverName;
					this.driverreg.idcard = res.data.data.userModel.idcard || res.data.data.userModel.idcard;
					this.driverreg.tqc = res.data.data.userModel.tqc;
					this.driverreg.idcardValidDate = res.data.data.userModel.idcardStartDate + '-' + res.data.data.userModel.idcardEndDate;
					this.driverreg.idcardStartDate = res.data.data.userModel.idcardStartDate;
					this.driverreg.idcardEndDate = res.data.data.userModel.idcardEndDate;
					this.driverreg.driverStartDate = res.data.data.userModel.driverStartDate;
					this.driverreg.driverEndDate = res.data.data.userModel.driverEndDate;
					this.driverreg.driverLcsValidDate = res.data.data.userModel.driverStartDate + '-' + res.data.data.userModel.driverEndDate;

					// let that = this;
					// that.wxRequest({
					// 	url: `${that.API}/driverService/getDriverIdCardInfo`,
					// 	method: 'POST',
					// 	data: {
					// 		driverId: driverId,
					//      platformCoNo: that.platformCoNo
					// 	},
					// 	title: '加载中...',
					// 	success: res => {
					// 		that.idPhotoUp = res.data.data.idcard1Base64;
					// 		that.idPhotoDown = res.data.data.idcard2Base64;
					// 	}
					// });
				}
			});
		}
		this.driverreg.etpId = options.etpId;
		this.driverreg.etpName = options.etpName || uni.getStorageSync(this.DATA_KEY.userInfo).etpName;
		this.disableEtpName = this.driverreg.etpName
		this.driverreg.exemptCode = options.exemptCode;
		let that = this;
		that.wxRequest({
			// 获取ip
			url: `${that.API}/driverService/getIp`,
			success(res) {
				that.ipAddress = res.data.data.ip
			}
		});
		uni.getSystemInfo({
			success: function(res) {
				that.macAddress = res.deviceId;
				console.log('macAddress ,', res.deviceId);
			}
		});
	}
};
</script>

<style lang="scss">
	.popup-wrap{
		// padding: 0 24rpx calc(24rpx + env(safe-area-inset-bottom));
		padding: 0 24rpx calc(24rpx);
		color: #007aff;
		text-align: center;
		background: transparent;
		.popup-describe{
			color: #fff;
			position: absolute;
			top: -55vh;
			left: 50%;
			transform: translate(-50%, 0);
			.title{
				margin: 24rpx 0;
				font-size: 36rpx;
			}
			.desc{
				font-size: 24rpx;
			}
		}
		.popup-box{
			background: #fff;
			margin-bottom: 24rpx;
			border-radius: 8rpx;
			view{
				padding: 24rpx 0;
				&:first-child{
					border-bottom: 1rpx solid #f9f9f9;
				}
			}
		}
		.popup-cancel{
			background: #fff;
			padding: 24rpx 0;
			border-radius: 8rpx;
		}
	}
page {
	background: #ffffff;
}
.desc-css{
	font-size: 24rpx;
	color: #4175F7;
	padding: 0 30rpx;
}
.row-css {
	display: flex;
	flex-direction: row;
}

.column-css {
	display: flex;
	flex-direction: column;
}
.view-cente {
	background: #ffffff;
	padding: 0 30rpx;
}
.view-cente-cle {
	padding: 25rpx 0;
	border-bottom: 1rpx solid #eeeeee;
}
.view-cente-cle-text {
	width: 180rpx;
	color: #5f6579;
}
.code-view {
	display: flex;
	width: 230rpx;
	font-size: 28rpx;
	color: #ffffff;
	background: #2979ff;
	justify-content: center;
	align-items: center;
	border: 1rpx solid #2979ff;
	padding: 15rpx 0;
}
.view-button {
	display: flex;
	flex: 1;
	background: #2b7cff;
	border-radius: 5rpx;
	padding: 20rpx;
	margin: 30rpx;
	/* margin-top: 50rpx; */
	justify-content: center;
	color: #ffffff;
}
.ul {
	position: absolute;
	margin-top: 30rpx;
	left: 0;
	top: 100%;
	width: 100%;
	background: #ffffff;
}
.li {
	border-bottom: 1rpx solid #eeeeee;
	padding: 25rpx 20rpx;
}
</style>
